﻿
CREATE Procedure s_VerItem_LevelUp
	(
	@ID int
	)
As

DECLARE @ParentID int,@Pos int

SELECT @ParentID = ParentID,@Pos = Pos+1 FROM t_Verification
WHERE ID = (SELECT ParentID FROM t_Verification WHERE ID=@ID)

IF EXISTS(SELECT * FROM t_Verification WHERE ID=@ID AND ParentID = 0) BEGIN
	RAISERROR('It''s as UP as possible, Doc.',16,1)
	RETURN
END

UPDATE t_Verification
SET ParentID = @ParentID,Pos = @Pos
WHERE ID = @ID
